#ifndef __BASIC_TYPES_H__
#define __BASIC_TYPES_H__

#define VOID           		void
typedef unsigned char		uint8;
typedef char				int8;
typedef unsigned short		uint16;
typedef short				int16;
typedef unsigned int		uint32;
typedef int					int32;
typedef char				CHAR;
typedef unsigned char		UCHAR;
typedef int					INT;
typedef unsigned int		UINT;
typedef long				LONG;
typedef unsigned long		ULONG;
typedef unsigned long long	ULONG64;
typedef short				SHORT;
typedef unsigned short		USHORT;
typedef int 				bool;
typedef void*				handle;
enum {TRUE=1, FALSE = 0};
typedef enum
{
	MF_SUCCESS = 0,
	MF_FAILURE = -1,
}MF_RET_CODE;

typedef struct
{
	uint16 year;
	uint8 month;
	uint8 day;
	uint8 hour;
	uint8 min;
	uint8 sec;
}date_time;

#define null 0

#define OSD_INVALID_ID (void*)-1

typedef int MF_GE_PF_E;
typedef int MF_GE_COMPOPT_E;
typedef int MF_GE_CKEY_E;
typedef int MF_GE_ROP_E;

typedef enum
{
	SMT32_OS_MUTEX_ATTR_TIMED_NP
}SMT32_OS_MUTEX_ATTR;

MF_RET_CODE stm32_os_sem_wait(handle sem,ULONG timeout);
MF_RET_CODE  stm32_os_sem_post(handle sem);
MF_RET_CODE stm32_os_sem_destroy(handle sem);
MF_RET_CODE stm32_os_sem_create(int8 *name,int max,int val, handle *sem);
uint32 stm32_os_get_tick(void);
uint16 stm32_get_screen_width(void);
uint16 stm32_get_screen_height(void);
MF_RET_CODE stm32_os_mutex_lock(handle lock, int32 timeout);
MF_RET_CODE stm32_os_mutex_unlock(handle lock);
MF_RET_CODE stm32_os_mutex_create(int8 *name, SMT32_OS_MUTEX_ATTR attr,handle * lock);
MF_RET_CODE stm32_os_msgque_create(int8 *name ,int len,  uint8 *buff, int s, int attr,handle *msgid);
MF_RET_CODE stm32_os_msgque_send(handle msgid, void* msg, int s, int timeout);
MF_RET_CODE stm32_os_msgque_receive(handle msgid, void* msg, int *s, int timeout);
MF_RET_CODE stm32_os_msgque_destroy(handle msgid);
MF_RET_CODE stm32_os_task_create(int8 *name , void (*fun)(ULONG param), void *param,int level, int s, handle *taskId);
MF_RET_CODE stm32_os_task_cancel( handle taskId);
MF_RET_CODE stm32_os_task_getcurhandle();
MF_RET_CODE stm32_os_task_detach(handle taskId );
MF_RET_CODE stm32_os_timer_activate(handle timer,  bool bl);
MF_RET_CODE stm32_os_timer_create(int8 *name ,bool bl, handle *timer);
MF_RET_CODE stm32_os_timer_setcallback(handle timer, void *func, void *param);
MF_RET_CODE stm32_os_timer_settime(handle timer, int32 timeout);
MF_RET_CODE stm32_os_timer_destroy(handle timer);

uint32 stm32_os_get_tick(void);
uint16 stm32_get_screen_width(void);
uint16 stm32_get_screen_height(void);
void stm32_os_task_sleep(int32 m);

#define ASSERT(val)

#endif
